package com.aggregate.pay.xinfu;

import com.aggregate.pay.xinfu.bean.PayOrderData;
import com.aggregate.pay.xinfu.bean.PayOrderResult;
import com.aggregate.pay.xinfu.bean.PayQueryData;
import com.aggregate.pay.xinfu.bean.PayQueryResult;
import com.aggregate.pay.xinfu.support.Client;
import com.aggregate.pay.xinfu.support.Config;
import com.aggregate.pay.xinfu.support.Factory;
import com.aggregate.pay.xinfu.support.HttpClient;
import com.aggregate.pay.xinfu.support.Merch;
import com.aggregate.pay.xinfu.support.client.PayNotify;
import com.aggregate.pay.xinfu.support.client.PayOrder;
import com.aggregate.pay.xinfu.support.client.PayQuery;

/**
 * 支付接口工具类，相关配置和接口调用从此类开始
 * @author Moyq5
 * @date 2018年8月31日
 */
public abstract class XinfuApiFactory {

	public static void config(Config config, HttpClient httpClient) {
		Factory.setConfig(config);
		Factory.setHttpClient(httpClient);
	}
	
	@SuppressWarnings("unchecked")
	public static Client<PayOrderData, PayOrderResult> payOrderClient(Merch merch) {
		return (Client<PayOrderData, PayOrderResult>)Factory.getClient(PayOrder.class, merch);
	}
	
	@SuppressWarnings("unchecked")
	public static Client<PayQueryData, PayQueryResult> payQueryClient(Merch merch) {
		return (Client<PayQueryData, PayQueryResult>)Factory.getClient(PayQuery.class, merch);
	}

	@SuppressWarnings("unchecked")
	public static Client<String, Boolean> payNotifyClient(Merch merch) {
		return (Client<String, Boolean>)Factory.getClient(PayNotify.class, merch);
	}

}
